package com.wtx.fitness.exception;

import com.wtx.fitness.common.ResultCode;

/**
 * 未授权异常
 * 用于表示用户未登录或没有权限访问某资源
 */
public class UnauthorizedException extends RuntimeException {

  private int code;

  public UnauthorizedException() {
    super(ResultCode.UNAUTHORIZED.getMessage());
    this.code = ResultCode.UNAUTHORIZED.getCode();
  }

  public UnauthorizedException(String message) {
    super(message);
    this.code = ResultCode.UNAUTHORIZED.getCode();
  }

  public int getCode() {
    return code;
  }
}